Skip to content

Skip choices for nullable argument in RequestParser#742

Open
dzhurinskij wants to merge 1 commit intonoirbizarre:masterfrom
dzhurinskij:master
Open

Skip choices for nullable argument in RequestParser#742
dzhurinskij wants to merge 1 commit intonoirbizarre:masterfrom
dzhurinskij:master

Conversation

@dzhurinskij
Copy link

@dzhurinskij dzhurinskij commented Oct 22, 2019

Hi.

It's fix popular case with arguments which can be choices or nullable.

parser = reqparse.RequestParser()
parser.add_argument('description', type=str, required=False, store_missing=False, nullable=True)
parser.add_argument('location_id', type=int, required=False, store_missing=False, nullable=True, choices=db.session.query(Locations.id).filter(Locations.deleted_at.is_(None)).values())
args = parser.parse_args(strict=True)

@andreixk
Copy link

@adzhurinskij You need to modify unit tests accordingly in order to ensure the checks are passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants